package org.jeecg.modules.performance.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.util.oConvertUtils;
import org.jeecg.modules.performance.entity.PerforSpeardUser;
import org.jeecg.modules.performance.service.IPerforSpeardUserService;
import java.util.Date;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import com.alibaba.fastjson.JSON;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

 /**
 * @Description: PerforSpeardUser
 * @Author: jeecg-boot
 * @Date:   2021-04-19
 * @Version: V1.0
 */
@Slf4j
@Api(tags="PerforSpeardUser")
@RestController
@RequestMapping("/performance/perforSpeardUser")
public class PerforSpeardUserController extends JeecgController<PerforSpeardUser, IPerforSpeardUserService> {
	@Autowired
	private IPerforSpeardUserService perforSpeardUserService;

	/**
	 * 分页列表查询
	 *
	 * @param perforSpeardUser
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@AutoLog(value = "PerforSpeardUser-分页列表查询")
	@ApiOperation(value="PerforSpeardUser-分页列表查询", notes="PerforSpeardUser-分页列表查询")
	@GetMapping(value = "/list")
	public Result<?> queryPageList(PerforSpeardUser perforSpeardUser,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		QueryWrapper<PerforSpeardUser> queryWrapper = QueryGenerator.initQueryWrapper(perforSpeardUser, req.getParameterMap());
		Page<PerforSpeardUser> page = new Page<PerforSpeardUser>(pageNo, pageSize);
		IPage<PerforSpeardUser> pageList = perforSpeardUserService.page(page, queryWrapper);
		return Result.ok(pageList);
	}

	/**
	 * 添加
	 *
	 * @param perforSpeardUser
	 * @return
	 */
	@AutoLog(value = "PerforSpeardUser-添加")
	@ApiOperation(value="PerforSpeardUser-添加", notes="PerforSpeardUser-添加")
	@PostMapping(value = "/add")
	public Result<?> add(@RequestBody PerforSpeardUser perforSpeardUser) {
		perforSpeardUserService.save(perforSpeardUser);
		return Result.ok("添加成功！");
	}

	/**
	 * 编辑
	 *
	 * @param perforSpeardUser
	 * @return
	 */
	@AutoLog(value = "PerforSpeardUser-编辑")
	@ApiOperation(value="PerforSpeardUser-编辑", notes="PerforSpeardUser-编辑")
	@PutMapping(value = "/edit")
	public Result<?> edit(@RequestBody PerforSpeardUser perforSpeardUser) {
		perforSpeardUserService.updateById(perforSpeardUser);
		return Result.ok("编辑成功!");
	}

	/**
	 * 通过id删除
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "PerforSpeardUser-通过id删除")
	@ApiOperation(value="PerforSpeardUser-通过id删除", notes="PerforSpeardUser-通过id删除")
	@DeleteMapping(value = "/delete")
	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
		perforSpeardUserService.removeById(id);
		return Result.ok("删除成功!");
	}



}
